<template>
<div class="company">
    <div class="wCen" v-if="companyInfo">
        <!-- 左侧公司基本信息 -->
        <div class="company_l">
            <div class="logoCompany">
                <!-- logo -->
                <!-- 公司名和资质 -->
                <div class="logoCompany_r">
                    <div class="left">
                        <div class="logoCompany_logo">
                            <img :src="companyInfo.logo" alt="" class="img" v-if="companyInfo.logo">
                            <img :src="defaultImg" alt="" class="img" v-else>
                        </div>
                        <!-- 公司名称 -->
                        <p class="logoCompany_r_t">{{companyInfo.companyName}}</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</template>

<script>
export default {
    props: {
        companyInfo: {
            type: Object,
            required: true,
        }
    },
    data(){
        return{
            defaultImg:require('@/assets/img/logo.svg')
        }
    }
}
</script>

<style lang="scss" scoped>
.company {
    $wL: 100%;
    height: 80px;
    background-color: #F6F7FA;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .wCen {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    // 公司信息
    &_l {
        flex: 0 0 $wL;
        width: $wL;
    }

    // logo 公司名称 资质
    .logoCompany {
        display: flex;
        align-items: center;
        font-size: 20px;
        font-weight: bold;

        // logo
        &_logo {
            $wh: 60px;
            max-height:$wh;
            max-width: $wh;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-right: 10px;

            .img {
                max-width: 100%;
                max-height: 100%;
            }
        }

        // 公司名
        &_r {
            display: flex;
            align-items: center;
            box-sizing: border-box;
            flex: 0 0 100%;

            .left {
                display: flex;
                align-items: center;
            }

            // 公司名称
            &_t {
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                display: block;
                line-height: 1em;
                font-size: 16px;
                color: #2D394B;
                margin-right: 40px;
            }
        }
    }
}
</style>
<style lang="scss" scoped>
@media (max-width:767px) {
    .company {
        height: auto;

        .wCen {}

        .logoCompany {
            &_r {
                flex-direction: column;
                box-sizing: border-box;
                align-items: flex-start;

                &_t {
                    margin-right: 0;
                }

                &_b {
                    width: 100%;

                    .collectBox {
                        display: flex;
                    }
                }
            }
        }
    }
}
</style>
